//
// event manager
//
// wangsihong@live.com
//

#ifndef Rooftop_RFEventManager_H
#define Rooftop_RFEventManager_H

#include "RFEventBase.h"
#include "SignalMap.h"

namespace Rooftop {
    
    class EventManager : public RFObject
    {
        public:

        int addEventListener(const char* estr);

        int addEventCallback(const char* estr, bool _cb(EventBase &));

        boost::signals2::connection addEventCallback(const char* estr, boost::signals2::signal<bool (EventBase &)>::slot_function_type cb);

        int removeEventListener(const char* estr);

        int removeEventCallback(const char* estr, bool _cb(EventBase &));

        int getNumSlots(std::string eventType);

        int dispachEvent(EventBase &event);

        static EventManager* getInstance();

        private:

        EventManager() {}
        static EventManager *p_instance;
        std::vector<EventBase> m_estrMap;
        SignalMap<bool (EventBase &)> m_eventSignalMap;
    };

}

#endif

